<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<body style="background:#f7fafd">

<div class="container">
    <div class="row">
        <div class="col-md-12" style="font-size:22px">
            <ul class="nav nav-tabs nav-justified">

                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        成果管理<span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a onclick="switchPage(4)">管理论文</a></li>
                        <li><a onclick="switchPage(5)">管理项目</a></li>
                        <li><a onclick="switchPage(6)">管理专利</a></li>
                        <li><a onclick="switchPage(18)">管理著作</a></li>
                    </ul>
                </li>
                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        教师管理<span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a onclick="switchPage(7)">添加教师</a></li>
                        <li><a onclick="switchPage(8)">教师管理</a></li>
                    </ul>
                </li>
                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        推送消息<span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a onclick="switchPage(10)">全体教师</a></li>
                        <li><a onclick="switchPage(12)">指定教师</a></li>
                    </ul>
                </li>

                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        个人信息<span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a onclick="switchPage(13)">修改密码</a></li>
                        <%--<li><a href="#"></a></li>--%>
                        <li><a onclick="switchPage(16)">修改个人信息</a></li>
                    </ul>
                </li>
                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                       aria-expanded="false">
                        其他操作<span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a onclick="switchPage(17)">注销</a></li>
                    </ul>
                </li>

            </ul>
        </div>
    </div>
</div>

<script>
    function switchPage(pageNum) {
        if (pageNum == 1) {
            window.location.replace("./admin_check_paper.jsp");
        } else if (pageNum == 2) {
            window.location.replace("./admin_check_project.jsp");
        } else if (pageNum == 3) {
            window.location.replace("./admin_check_patent.jsp");
        } else if (pageNum == 4) {
            window.location.replace("./admin_manage_paper.jsp");
        } else if (pageNum == 5) {
            window.location.replace("./admin_manage_project.jsp");
        } else if (pageNum == 6) {
            window.location.replace("./admin_manage_patent.jsp");
        } else if (pageNum == 7) {
            window.location.replace("./admin_teacher_add.jsp");
        } else if (pageNum == 8) {
            window.location.replace("./admin_teacher_delete.jsp");
        } else if (pageNum == 9) {
            window.location.replace("./admin_teacher_update.jsp");
        } else if (pageNum == 10) {
            window.location.replace("./admin_message.jsp");
        } else if (pageNum == 11) {
            window.location.replace("./admin_check_paper.jsp");
        } else if (pageNum == 12) {
            window.location.replace("./message_to_teacher.jsp");
        } else if (pageNum == 13) {
            window.location.replace("./change_pas.jsp");
        } else if (pageNum == 14) {
            window.location.replace("./admin_check_paper.jsp");
        } else if (pageNum == 15) {
            window.location.replace("./admin_papers.jsp");
        } else if (pageNum == 16) {
            window.location.replace("./admin_change_inf.jsp");
        } else if (pageNum == 17) {
            $.ajax({//()里面是JSON数据，外层要加上{}。
                url: "${APP_PATH}/logout",//处理页面地址，表示ajax要用哪个页面处理
                type: "POST",
                dataType: "JSON",//返回值的类型。
                success: function (result) {
                    alert(result.message + "...正在跳转主页面!");
                    window.location.replace("../index.jsp");
                },
                error: function (data) {//处理页面出错以后执行的函数。
                    console.log(data);
                    alert("未知的错误！");
                }
            });
        } else if (pageNum == 18) {
            window.location.replace("./admin_manage_works.jsp");
        } else {
            alert("错误的跳转哦。");
        }
    }
</script>
